VERSION 5.00
Object = "{00025600-0000-0000-C000-000000000046}#5.2#0"; "crystl32.ocx"
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"
Begin VB.Form frmORD560 
   BackColor       =   &H00800000&
   Caption         =   "PUR500"
   ClientHeight    =   8595
   ClientLeft      =   270
   ClientTop       =   240
   ClientWidth     =   11505
   ControlBox      =   0   'False
   LinkTopic       =   "Form1"
   ScaleHeight     =   8595
   ScaleWidth      =   11505
   Begin VB.CommandButton cmdExit 
      Caption         =   "&Exit"
      Height          =   456
      Left            =   7800
      TabIndex        =   81
      Top             =   8040
      Width           =   1128
   End
   Begin VB.CommandButton cmdCancel 
      Caption         =   "&Cancel"
      Height          =   456
      Left            =   6600
      TabIndex        =   80
      Top             =   8040
      Width           =   1128
   End
   Begin VB.CommandButton CmdPreInvoice 
      Caption         =   "Preview Invoice"
      Height          =   456
      Left            =   3000
      TabIndex        =   73
      Top             =   8040
      Width           =   1128
   End
   Begin VB.CommandButton cmdReview 
      Caption         =   "&Review Order"
      Height          =   456
      Left            =   1800
      TabIndex        =   72
      Top             =   8040
      Width           =   1128
   End
   Begin VB.CommandButton cmdEdit 
      Caption         =   "&Edit"
      Height          =   456
      Left            =   4200
      TabIndex        =   71
      Top             =   8040
      Width           =   1128
   End
   Begin VB.CheckBox chkEHEXP 
      BackColor       =   &H00800000&
      Caption         =   "Export"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H000080FF&
      Height          =   225
      Left            =   195
      TabIndex        =   70
      Top             =   510
      Width           =   1020
   End
   Begin VB.TextBox txtEHAMT 
      BeginProperty Font 
         Name            =   "Verdana"
         Size            =   7.5
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   288
      Left            =   9870
      Locked          =   -1  'True
      TabIndex        =   59
      Top             =   7710
      Width           =   1425
   End
   Begin VB.TextBox txtEHVAM 
      BeginProperty Font 
         Name            =   "Verdana"
         Size            =   7.5
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   288
      Left            =   7380
      Locked          =   -1  'True
      TabIndex        =   58
      Top             =   7680
      Width           =   1185
   End
   Begin VB.TextBox txtEHBVA 
      BeginProperty Font 
         Name            =   "Verdana"
         Size            =   7.5
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   288
      Left            =   1725
      Locked          =   -1  'True
      TabIndex        =   57
      Top             =   7695
      Width           =   1260
   End
   Begin VB.TextBox txtEHBCA 
      BeginProperty Font 
         Name            =   "Verdana"
         Size            =   7.5
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   288
      Left            =   4350
      Locked          =   -1  'True
      TabIndex        =   56
      Top             =   7695
      Width           =   1170
   End
   Begin VB.Frame FrameECLine 
      BackColor       =   &H00E0E0E0&
      BorderStyle     =   0  'None
      Caption         =   "Frame1"
      Height          =   1800
      Left            =   120
      TabIndex        =   33
      Top             =   3240
      Width           =   11160
      Begin VB.TextBox txtELWGT 
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   288
         Left            =   6195
         TabIndex        =   79
         Top             =   570
         Width           =   975
      End
      Begin VB.TextBox txtELPSW 
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   288
         Left            =   7365
         TabIndex        =   78
         Top             =   570
         Width           =   975
      End
      Begin VB.TextBox txtELQTY 
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   288
         Left            =   1920
         TabIndex        =   77
         Top             =   600
         Width           =   975
      End
      Begin VB.TextBox txtELPSQ 
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   288
         Left            =   3030
         TabIndex        =   76
         Top             =   600
         Width           =   975
      End
      Begin VB.TextBox txtELVAT 
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   288
         Left            =   9495
         TabIndex        =   66
         Top             =   1050
         Width           =   855
      End
      Begin MSDataListLib.DataCombo cboELITN 
         Bindings        =   "frmORD560.frx":0000
         Height          =   375
         Left            =   7665
         TabIndex        =   55
         Top             =   105
         Visible         =   0   'False
         Width           =   3500
         _ExtentX        =   6165
         _ExtentY        =   661
         _Version        =   393216
         ListField       =   "IMITD"
         BoundColumn     =   "IMITN"
         Text            =   ""
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "VNI-Times"
            Size            =   9.75
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
      End
      Begin VB.ComboBox cboELSTT 
         ForeColor       =   &H000000FF&
         Height          =   315
         ItemData        =   "frmORD560.frx":0015
         Left            =   9510
         List            =   "frmORD560.frx":002E
         TabIndex        =   44
         Top             =   1425
         Width           =   1500
      End
      Begin VB.TextBox txtELAMT 
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   288
         Left            =   6195
         Locked          =   -1  'True
         TabIndex        =   43
         Top             =   1470
         Width           =   1155
      End
      Begin VB.TextBox txtELBCA 
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   288
         Left            =   1890
         Locked          =   -1  'True
         TabIndex        =   42
         Top             =   1470
         Width           =   1155
      End
      Begin VB.ComboBox cboELPER 
         Height          =   315
         ItemData        =   "frmORD560.frx":0081
         Left            =   6210
         List            =   "frmORD560.frx":008E
         TabIndex        =   41
         Top             =   1035
         Width           =   1230
      End
      Begin VB.TextBox txtELPRC 
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   288
         Left            =   1905
         TabIndex        =   40
         Top             =   1035
         Width           =   975
      End
      Begin VB.TextBox txtELITN 
         Alignment       =   1  'Right Justify
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   315
         Left            =   6195
         TabIndex        =   39
         Top             =   105
         Width           =   1425
      End
      Begin VB.TextBox txtELITD 
         BeginProperty Font 
            Name            =   "VNI-Times"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         Left            =   7665
         Locked          =   -1  'True
         TabIndex        =   38
         Top             =   105
         Width           =   2550
      End
      Begin VB.TextBox txtELOLN 
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   288
         Left            =   1905
         Locked          =   -1  'True
         TabIndex        =   37
         Top             =   75
         Width           =   525
      End
      Begin VB.TextBox txtELPDC 
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   288
         Left            =   9495
         TabIndex        =   36
         Top             =   600
         Width           =   825
      End
      Begin VB.TextBox txtELBVA 
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   288
         Left            =   3135
         Locked          =   -1  'True
         TabIndex        =   35
         Top             =   1485
         Width           =   930
      End
      Begin VB.TextBox txtELVAM 
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   288
         Left            =   7470
         Locked          =   -1  'True
         TabIndex        =   34
         Top             =   1455
         Width           =   930
      End
      Begin VB.Line Line5 
         X1              =   7320
         X2              =   7200
         Y1              =   600
         Y2              =   810
      End
      Begin VB.Line Line4 
         X1              =   3000
         X2              =   2880
         Y1              =   600
         Y2              =   825
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "VAT %"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   255
         Index           =   26
         Left            =   8790
         TabIndex        =   67
         Top             =   1080
         Width           =   615
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "Line status"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H000000FF&
         Height          =   240
         Index           =   23
         Left            =   8430
         TabIndex        =   54
         Top             =   1455
         Width           =   975
      End
      Begin VB.Label lbl 
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Caption         =   "Base currency/VAT"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   255
         Index           =   22
         Left            =   45
         TabIndex        =   53
         Top             =   1515
         Width           =   1845
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "Line amount/VAT"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   255
         Index           =   21
         Left            =   4530
         TabIndex        =   52
         Top             =   1515
         Width           =   1620
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "Price Per"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   255
         Index           =   20
         Left            =   5265
         TabIndex        =   51
         Top             =   1095
         Width           =   855
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "Unit price"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   255
         Index           =   19
         Left            =   975
         TabIndex        =   50
         Top             =   1080
         Width           =   870
      End
      Begin VB.Label lbl 
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Caption         =   "Weight Cust. Order / Packed slip"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   405
         Index           =   18
         Left            =   4410
         TabIndex        =   49
         Top             =   510
         Width           =   1665
      End
      Begin VB.Label lbl 
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Caption         =   "Quantity Cust. Order / Packed slip"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   390
         Index           =   17
         Left            =   60
         TabIndex        =   48
         Top             =   540
         Width           =   1785
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "Item No"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   255
         Index           =   16
         Left            =   5325
         TabIndex        =   47
         Top             =   105
         Width           =   750
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "Invoice lines"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   255
         Index           =   15
         Left            =   720
         TabIndex        =   46
         Top             =   135
         Width           =   1140
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "Discount %"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   255
         Index           =   24
         Left            =   8370
         TabIndex        =   45
         Top             =   615
         Width           =   1065
      End
      Begin VB.Line Line2 
         X1              =   3120
         X2              =   3000
         Y1              =   1500
         Y2              =   1725
      End
      Begin VB.Line Line3 
         X1              =   7440
         X2              =   7320
         Y1              =   1500
         Y2              =   1710
      End
   End
   Begin MSAdodcLib.Adodc Adodc7 
      Height          =   375
      Left            =   5130
      Top             =   90
      Visible         =   0   'False
      Width           =   1740
      _ExtentX        =   3069
      _ExtentY        =   661
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   ""
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   ""
      Caption         =   "7 SMM"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin MSAdodcLib.Adodc Adodc6 
      Height          =   330
      Left            =   9390
      Top             =   435
      Visible         =   0   'False
      Width           =   1830
      _ExtentX        =   3228
      _ExtentY        =   582
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   ""
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   ""
      Caption         =   "6 ECH"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin VB.Frame FrameBB 
      BackColor       =   &H00800000&
      BorderStyle     =   0  'None
      Caption         =   "Frame2"
      Height          =   2760
      Left            =   120
      TabIndex        =   1
      Top             =   720
      Width           =   11400
      Begin VB.TextBox txtEHPTC 
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   288
         Left            =   10035
         TabIndex        =   68
         Top             =   1770
         Width           =   1170
      End
      Begin MSDataListLib.DataCombo cboEHCCD 
         Bindings        =   "frmORD560.frx":00AF
         Height          =   315
         Left            =   6360
         TabIndex        =   32
         Top             =   2130
         Visible         =   0   'False
         Width           =   1470
         _ExtentX        =   2593
         _ExtentY        =   556
         _Version        =   393216
         ListField       =   "CMCCD"
         BoundColumn     =   "CMCCD"
         Text            =   ""
      End
      Begin VB.TextBox txtEHCCD 
         Height          =   315
         Left            =   6420
         TabIndex        =   31
         Top             =   2130
         Width           =   1170
      End
      Begin MSDataListLib.DataCombo cboEHSNO 
         Bindings        =   "frmORD560.frx":00C4
         Height          =   360
         Left            =   6420
         TabIndex        =   30
         Top             =   885
         Visible         =   0   'False
         Width           =   3090
         _ExtentX        =   5450
         _ExtentY        =   635
         _Version        =   393216
         ListField       =   "MMNME"
         BoundColumn     =   "MMSNO"
         Text            =   ""
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "VNI-Helve"
            Size            =   9
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
      End
      Begin VB.TextBox txtMMNME 
         BeginProperty Font 
            Name            =   "VNI-Helve"
            Size            =   9
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   288
         Left            =   7335
         TabIndex        =   29
         Top             =   900
         Width           =   2160
      End
      Begin VB.TextBox txtEHCPO 
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   288
         Left            =   6405
         TabIndex        =   28
         Top             =   1740
         Width           =   1170
      End
      Begin VB.TextBox txtEHNOL 
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   288
         Left            =   1665
         TabIndex        =   27
         Top             =   2160
         Width           =   480
      End
      Begin VB.TextBox txtEHSNO 
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   288
         Left            =   6420
         TabIndex        =   26
         Top             =   900
         Width           =   885
      End
      Begin VB.TextBox txtEHDUE 
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   288
         Left            =   1680
         TabIndex        =   25
         Top             =   1770
         Width           =   1215
      End
      Begin VB.TextBox txtEHSTA 
         BeginProperty Font 
            Name            =   "VNI-Helve"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   288
         Left            =   6420
         TabIndex        =   24
         Top             =   1335
         Width           =   3105
      End
      Begin VB.TextBox txtEHSTN 
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   288
         Left            =   1680
         TabIndex        =   23
         Top             =   1350
         Width           =   1215
      End
      Begin MSDataListLib.DataCombo cboEHCNO 
         Bindings        =   "frmORD560.frx":00D9
         Height          =   360
         Left            =   1680
         TabIndex        =   16
         Top             =   840
         Visible         =   0   'False
         Width           =   3075
         _ExtentX        =   5424
         _ExtentY        =   635
         _Version        =   393216
         ListField       =   "CMNME"
         BoundColumn     =   "CMCNO"
         Text            =   ""
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "VNI-Helve"
            Size            =   9
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
      End
      Begin VB.TextBox txtEHODN 
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   288
         Left            =   1680
         TabIndex        =   8
         Top             =   540
         Width           =   1215
      End
      Begin VB.TextBox txtEHDTE 
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   288
         Left            =   6435
         TabIndex        =   7
         Top             =   510
         Width           =   1170
      End
      Begin VB.TextBox txtEHCNO 
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   288
         Left            =   1680
         TabIndex        =   6
         Top             =   900
         Width           =   750
      End
      Begin VB.TextBox txtEHCER 
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   288
         Left            =   10035
         TabIndex        =   5
         Top             =   2115
         Width           =   1170
      End
      Begin VB.TextBox txtCMNME 
         BeginProperty Font 
            Name            =   "VNI-Helve"
            Size            =   9
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   288
         Left            =   2490
         TabIndex        =   4
         Top             =   900
         Width           =   2235
      End
      Begin VB.ComboBox cboEHSTT 
         ForeColor       =   &H000000FF&
         Height          =   315
         ItemData        =   "frmORD560.frx":00EE
         Left            =   9930
         List            =   "frmORD560.frx":0107
         TabIndex        =   3
         Top             =   60
         Width           =   1350
      End
      Begin VB.ComboBox cboEHITP 
         Height          =   315
         ItemData        =   "frmORD560.frx":015A
         Left            =   4920
         List            =   "frmORD560.frx":0164
         TabIndex        =   2
         Top             =   30
         Width           =   1365
      End
      Begin Crystal.CrystalReport CrystalReport2 
         Left            =   0
         Top             =   0
         _ExtentX        =   741
         _ExtentY        =   741
         _Version        =   348160
         PrintFileLinesPerPage=   60
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "Term code"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00E0E0E0&
         Height          =   255
         Index           =   28
         Left            =   8610
         TabIndex        =   69
         Top             =   1800
         Width           =   1320
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "Number Of line"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00E0E0E0&
         Height          =   255
         Index           =   29
         Left            =   285
         TabIndex        =   22
         Top             =   2175
         Width           =   1320
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "Customer PO No"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00E0E0E0&
         Height          =   255
         Index           =   27
         Left            =   4860
         TabIndex        =   21
         Top             =   1830
         Width           =   1470
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "Payment due date"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00E0E0E0&
         Height          =   255
         Index           =   25
         Left            =   15
         TabIndex        =   20
         Top             =   1785
         Width           =   1590
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "Saleman No"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00E0E0E0&
         Height          =   255
         Index           =   10
         Left            =   5220
         TabIndex        =   19
         Top             =   960
         Width           =   1110
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "Ship to Address"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00E0E0E0&
         Height          =   255
         Index           =   8
         Left            =   4920
         TabIndex        =   18
         Top             =   1320
         Width           =   1425
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "Ship to No"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00E0E0E0&
         Height          =   255
         Index           =   6
         Left            =   675
         TabIndex        =   17
         Top             =   1395
         Width           =   900
      End
      Begin VB.Line Line1 
         X1              =   2160
         X2              =   5340
         Y1              =   5280
         Y2              =   4455
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "Order No"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00E0E0E0&
         Height          =   255
         Index           =   2
         Left            =   795
         TabIndex        =   15
         Top             =   570
         Width           =   825
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "Customer Order Date"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00E0E0E0&
         Height          =   255
         Index           =   3
         Left            =   4470
         TabIndex        =   14
         Top             =   540
         Width           =   1920
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "Order Type"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H0080FFFF&
         Height          =   255
         Index           =   4
         Left            =   3480
         TabIndex        =   13
         Top             =   120
         Width           =   1305
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "Customer No"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00E0E0E0&
         Height          =   255
         Index           =   5
         Left            =   495
         TabIndex        =   12
         Top             =   975
         Width           =   1110
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "Currency Code"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00E0E0E0&
         Height          =   255
         Index           =   7
         Left            =   5010
         TabIndex        =   11
         Top             =   2190
         Width           =   1320
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "Exchange Rate"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00E0E0E0&
         Height          =   255
         Index           =   9
         Left            =   8610
         TabIndex        =   10
         Top             =   2145
         Width           =   1320
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "Invoice status"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H000000FF&
         Height          =   255
         Index           =   13
         Left            =   8430
         TabIndex        =   9
         Top             =   120
         Width           =   1380
      End
   End
   Begin MSAdodcLib.Adodc Adodc5 
      Height          =   375
      Left            =   9000
      Top             =   75
      Visible         =   0   'False
      Width           =   1785
      _ExtentX        =   3149
      _ExtentY        =   661
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   ""
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   ""
      Caption         =   "5 CUR_EX"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin MSAdodcLib.Adodc Adodc4 
      Height          =   360
      Left            =   8190
      Top             =   390
      Visible         =   0   'False
      Width           =   1755
      _ExtentX        =   3096
      _ExtentY        =   635
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   ""
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   ""
      Caption         =   "4 INVOICE"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin MSAdodcLib.Adodc Adodc3 
      Height          =   345
      Left            =   8190
      Top             =   75
      Visible         =   0   'False
      Width           =   1725
      _ExtentX        =   3043
      _ExtentY        =   609
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   ""
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   ""
      Caption         =   "3 IIM"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin MSAdodcLib.Adodc Adodc2 
      Height          =   330
      Left            =   6870
      Top             =   420
      Visible         =   0   'False
      Width           =   1920
      _ExtentX        =   3387
      _ExtentY        =   582
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   ""
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   ""
      Caption         =   "2. AVM"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   330
      Left            =   6885
      Top             =   90
      Visible         =   0   'False
      Width           =   1935
      _ExtentX        =   3413
      _ExtentY        =   582
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   ""
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   ""
      Caption         =   "1 RCM"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin VB.CommandButton cmdSave 
      Caption         =   "&Save"
      Height          =   456
      Left            =   5400
      TabIndex        =   0
      Top             =   8040
      Width           =   1128
   End
   Begin MSDataGridLib.DataGrid grdECL 
      Bindings        =   "frmORD560.frx":0187
      Height          =   2220
      Left            =   150
      TabIndex        =   60
      Top             =   5430
      Width           =   11175
      _ExtentX        =   19711
      _ExtentY        =   3916
      _Version        =   393216
      BackColor       =   -2147483624
      ForeColor       =   8388608
      HeadLines       =   1
      RowHeight       =   19
      FormatLocked    =   -1  'True
      BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "VNI-Times"
         Size            =   9
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ColumnCount     =   11
      BeginProperty Column00 
         DataField       =   ""
         Caption         =   ""
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   1033
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column01 
         DataField       =   "ELOLN"
         Caption         =   "line"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   1033
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column02 
         DataField       =   "ELITN"
         Caption         =   "Item"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   1033
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column03 
         DataField       =   "ELITD"
         Caption         =   "Item Description"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   1033
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column04 
         DataField       =   "ELQTY"
         Caption         =   "Quantity"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   1033
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column05 
         DataField       =   "ELWGT"
         Caption         =   "Weight"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   1033
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column06 
         DataField       =   "ELPRC"
         Caption         =   "Unit price"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   1033
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column07 
         DataField       =   "ELPER"
         Caption         =   "Price per"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   1033
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column08 
         DataField       =   "ELAMT"
         Caption         =   "Line amount"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   1033
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column09 
         DataField       =   "ELBCA"
         Caption         =   "Base Cur Amount"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   1033
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column10 
         DataField       =   "ELSTT"
         Caption         =   "Status"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   1033
            SubFormatType   =   0
         EndProperty
      EndProperty
      SplitCount      =   1
      BeginProperty Split0 
         BeginProperty Column00 
            ColumnWidth     =   14.74
         EndProperty
         BeginProperty Column01 
            ColumnWidth     =   329.953
         EndProperty
         BeginProperty Column02 
            ColumnWidth     =   1184.882
         EndProperty
         BeginProperty Column03 
            ColumnWidth     =   2670.236
         EndProperty
         BeginProperty Column04 
            ColumnWidth     =   1065.26
         EndProperty
         BeginProperty Column05 
            ColumnWidth     =   1035.213
         EndProperty
         BeginProperty Column06 
            ColumnWidth     =   1094.74
         EndProperty
         BeginProperty Column07 
            ColumnWidth     =   1349.858
         EndProperty
         BeginProperty Column08 
            ColumnWidth     =   959.811
         EndProperty
         BeginProperty Column09 
            ColumnWidth     =   840.189
         EndProperty
         BeginProperty Column10 
            ColumnWidth     =   1110.047
         EndProperty
      EndProperty
   End
   Begin VB.Label lbl 
      BackStyle       =   0  'Transparent
      Caption         =   "ORD560"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   18
         Charset         =   0
         Weight          =   700
         Underline       =   -1  'True
         Italic          =   -1  'True
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00E0E0E0&
      Height          =   450
      Index           =   34
      Left            =   120
      TabIndex        =   75
      Top             =   0
      Width           =   1830
   End
   Begin VB.Label lbl 
      BackStyle       =   0  'Transparent
      Caption         =   "Preivoice Mantenance"
      BeginProperty Font 
         Name            =   "Verdana"
         Size            =   16.5
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   -1  'True
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00E0E0E0&
      Height          =   540
      Index           =   33
      Left            =   2280
      TabIndex        =   74
      Top             =   360
      Width           =   4470
   End
   Begin VB.Label lbl 
      BackStyle       =   0  'Transparent
      Caption         =   "Invoice lines"
      BeginProperty Font 
         Name            =   "Verdana"
         Size            =   7.5
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00E0E0E0&
      Height          =   255
      Index           =   14
      Left            =   30
      TabIndex        =   65
      Top             =   5130
      Width           =   1200
   End
   Begin VB.Label lbl 
      BackStyle       =   0  'Transparent
      Caption         =   "Base amount"
      BeginProperty Font 
         Name            =   "Verdana"
         Size            =   7.5
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00E0E0E0&
      Height          =   255
      Index           =   12
      Left            =   3135
      TabIndex        =   64
      Top             =   7725
      Width           =   1230
   End
   Begin VB.Label lbl 
      BackStyle       =   0  'Transparent
      Caption         =   "VAT Base amount"
      BeginProperty Font 
         Name            =   "Verdana"
         Size            =   7.5
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00E0E0E0&
      Height          =   255
      Index           =   11
      Left            =   45
      TabIndex        =   63
      Top             =   7695
      Width           =   1560
   End
   Begin VB.Label lbl 
      BackStyle       =   0  'Transparent
      Caption         =   "VND VAT amount"
      BeginProperty Font 
         Name            =   "Verdana"
         Size            =   7.5
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00E0E0E0&
      Height          =   255
      Index           =   30
      Left            =   5745
      TabIndex        =   62
      Top             =   7710
      Width           =   1560
   End
   Begin VB.Label lbl 
      BackStyle       =   0  'Transparent
      Caption         =   "VND Amount"
      BeginProperty Font 
         Name            =   "Verdana"
         Size            =   7.5
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00E0E0E0&
      Height          =   255
      Index           =   31
      Left            =   8640
      TabIndex        =   61
      Top             =   7725
      Width           =   1170
   End
End
Attribute VB_Name = "frmORD560"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim INVType(3), StaOrd(7), Per(3), OldEHODN As String, NewTrans As Byte, OldCurRate As Double
Dim WithEvents RecOrd As ADODB.Recordset
Attribute RecOrd.VB_VarHelpID = -1
Dim SQL As String
Private Sub UpdateAmt()
Dim DiscAMT, DiscBAM
Dim Nonvalue

On Error Resume Next
Select Case cboELPER.ListIndex + 1
    Case 1
        Nonvalue = IsEmpty(txtELQTY) And IsEmpty(txtELPRC) And IsEmpty(txtELPC)
        If Not Nonvalue Then
            txtELBCA = Val(txtELQTY) * (Val(txtELPRC) - (Val(txtELPRC) * Val(txtELPDC) / 100))
            txtELBVA = Val(txtELBCA) * Val(txtELVAT)
                    
            txtELAMT = CLng(Val(txtELQTY) * (Val(txtELPRC) - (Val(txtELPRC) * Val(txtELPDC) / 100)) * Val(txtEHCER))
            txtELVAM = CLng(Val(txtELAMT) * Val(txtELVAT))
        Else
            MsgBox "Check data again"
        End If
        
    Case 2
        Nonvalue = IsEmpty(txtELWGT) And IsEmpty(txtELPRC) And IsEmpty(txtELPC)
        If Not Nonvalue Then
            txtELBCA = Val(txtELWGT) * (Val(txtELPRC) - (Val(txtELPRC) * Val(txtELPDC) / 100))
            txtELBVA = Val(txtELBCA) * Val(txtELVAT)
                    
            txtELAMT = CLng(Val(txtELWGT) * (Val(txtELPRC) - (Val(txtELPRC) * Val(txtELPDC) / 100)) * Val(txtEHCER))         '+ Val(txtELVAM))
            txtELVAM = CLng(Val(txtELAMT) * Val(txtELVAT))
        Else
            MsgBox "Check data again"
        End If
End Select
'txtELVAT.SetFocus
End Sub
Private Sub cboEHCCD_Click(Area As Integer)
If Area = 2 Then
    txtEHCCD = cboEHCCD.Text
    cboEHCCD.Visible = False
    Dim RecCCI As Recordset
    Set RecCCI = DBconn.Execute("Select * from CCI where CICCD='" & txtEHCCD & "' order by CIDTE DESC")
    If Not RecCCI.EOF Then
        txtEHCER = RecCCI!CICCR
    Else
        txtEHCER = 0
    End If
End If
End Sub

Private Sub cboEHCNO_Click(Area As Integer)
If Area = 2 Then
    txtEHCNO = cboEHCNO.BoundText
    txtCMNME = cboEHCNO.Text
    cboEHCNO.Visible = False
    txtEHSNO.SetFocus
End If
End Sub


Private Sub cboEHITP_Click()
'    txtEHODN.SetFocus
End Sub

Private Sub cboEHSNO_Click(Area As Integer)
If Area = 2 Then
    txtEHSNO = cboEHSNO.BoundText
    txtMMNME = cboEHSNO.Text
    cboEHSNO.Visible = False
    txtEHSTN.SetFocus
End If
End Sub

Private Sub cboEHSTT_Click()
'MsgBox Left(cboEHSTT.List(cboEHSTT.ListIndex), 1)
End Sub

Private Sub cboELITN_Click(Area As Integer)
    If Area = 2 Then
        txtELITN = cboELITN.BoundText
        txtELPRC = Find("IIM", "IMPRC", "WHERE IMITN='" & txtELITN & "'")
     
            txtELITD = Find("IIM", "IMITD", " WHERE IMITN='" & txtELITN & "'")
    
        cboELITN.Visible = False
        txtELVAT = VATRate(txtEHCNO, txtELITN)
        txtELQTY.SetFocus
    End If
End Sub

Private Sub cboELPER_Click()
    Call UpdateAmt
End Sub


Private Sub cmdAddnew_Click()
NewTrans = True
ISADDING = True
ISEDITING = True
WriteToScreen
ButtonStatus
txtEHODN.SetFocus
End Sub

Private Sub cmdCancel_Click()
NewTrans = False
ISADDING = False
ISEDITING = False
WriteToScreen
ButtonStatus
End Sub

Private Sub cmddelline_Click()
If txtEHODN.Text <> "" And txtELITN.Text <> "" Then
    SQL = ""
    SQL = "SELECT     dbo.ECH.EHODN, dbo.ECL.ELITN " & _
    "FROM   dbo.ECH INNER JOIN dbo.ECL ON dbo.ECH.EHODN = dbo.ECL.ELODN " & _
    "WHERE     (dbo.ECH.EHSTT = '1') AND (dbo.ECL.ELSTT = '1') AND (dbo.ECH.EHODN = '" & Trim(txtEHODN.Text) & "')"
    Set RecOrd = New ADODB.Recordset
    RecOrd.Open SQL, ConnectString, adOpenKeyset, adLockOptimistic
    If RecOrd.RecordCount > 0 Then
        SQL = ""
        SQL = "delete from ECL where ELITN='" & Trim(txtELITN.Text) & "'"
        If MsgBox(" Do you want delete this line ?", vbDefaultButton2 + vbOKCancel + vbCritical, "Deleting...") = vbOK Then
            DBconn.Execute (SQL)
            WriteToScreen
        Else
            Exit Sub
        End If
    Else
        MsgBox "Can not delete this line !", vbCritical, "Warning"
        Exit Sub
    End If
Else
    MsgBox "The TextBox OrderNo or ItemNo is Empty...!", vbCritical, "Warning"
End If
End Sub

Private Sub cmdEdit_Click()
ISEDITING = True
'WriteToScreen
ButtonStatus
End Sub

Private Sub cmdExit_Click()
Unload frmORD560
End Sub

Private Sub cmdNewItem_Click()
'NewTrans = True
If txtEHODN <> "" Then
    ISADDING = True
    ISEDITING = True
    WriteToScreen
    ButtonStatus
End If
End Sub

Private Sub CmdPreInvoice_Click()
    CrystalReport2.ReportFileName = DDAN & "\Ord560.rpt"
    CrystalReport2.RetrieveStoredProcParams
    CrystalReport2.StoredProcParam(0) = txtEHODN
    CrystalReport2.Destination = crptToWindow
    CrystalReport2.Action = 1
End Sub

Private Sub cmdReview_Click()
frmReview.Tag = "ORD500"
frmReview.Show 1
ISEDITING = False
ISADDING = False
If frmReview.Tag <> "" Then
    txtEHODN = frmReview.Tag
    Unload frmReview
    txtELOLN = 1
    WriteToScreen
    cmdEdit.Enabled = True
End If
End Sub
Sub WriteToScreen()
Dim recECL As Recordset
If NewTrans Then
    cboEHITP.ListIndex = 0
    txtEHODN = ""
    txtEHDTE = Format(WorkingDate, "dd/mm/yyyy")
    txtEHCNO = ""
    txtEHNOL = 0
    txtCMNME = ""
    txtEHCPO = ""
    txtEHPTC = ""
    cboEHSTT.ListIndex = 0
    cboEHCCD = ""
    txtEHCCD = ""
    txtEHCER = 0
    txtEHAMT = 0
    txtEHVAM = 0
    txtEHBAM = 0
    txtEHBVA = 0
    txtEHSNO = ""
    txtMMNME = ""
    cboEHSNO = ""
    txtEHDUE = ""
    txtEHSTN = ""
    txtEHSTA = ""
    
End If

If ISADDING Then
   txtELITN = ""
   txtELITD = ""
   txtELOLN = 0
   txtELQTY = 0
   txtELPSQ = 0
   txtELWGT = 0
   txtELPSW = 0
   txtELPRC = 0
   cboELPER = ""
   txtELPDC = 0
   txtELAMT = 0 ' Line amount
   txtELVAM = 0 ' VAT line (VND)
   txtELBCA = 0 ' Base currency line amount
   txtELBVA = 0 ' VAT base currency
   txtELVAT = 0
   cboELSTT.ListIndex = 0
   StrCV = ""
Else
    
    'FROM AVM LEFT JOIN IIM ON AVM.VMVDN = IIM.IMVDC
    Set recECL = DBconn.Execute("select ECH.* from ECH where ECH.EHODN='" & txtEHODN & "'")
    If Not recECL.EOF Then
        With recECL
            For i = 0 To cboEHITP.ListCount - 1
                If Left(cboEHITP.List(i), 1) = !EHITP Then
                    cboEHITP.ListIndex = i
                    Exit For
                End If
            Next i
            'cboEHITP = INVType(!EHITP)
            txtEHNOL = IIf(IsNull(!EHNOL), 0, !EHNOL)
            txtEHODN = !EHODN
            OldEHODN = txtEHODN
            txtEHDTE = Format(!EHDTE, "dd/mm/yyyy")
            txtEHCNO = !EHCNO
            txtEHSTN = !EHSTN
            txtEHSTA = !EHSTA
            txtCMNME = Find("RCM", "CMNME", " WHERE CMCNO='" & txtEHCNO & "'")
            
            txtEHCPO = IIf(IsNull(!EHCPO), 0, !EHCPO)
            txtEHPTC = IIf(IsNull(!EHPTC), "", !EHPTC)
            For i = 0 To cboEHSTT.ListCount - 1
                If Left(cboEHSTT.List(i), 1) = !EHSTT Then
                    cboEHSTT.ListIndex = i
                    Exit For
                End If
            Next i
            'cboEHSTT = StaOrd(!EHSTT)
            cboEHCCD = !EHCCD
            txtEHCER = !EHCER
            OldCurRate = txtEHCER
            'txtEHORD = !EHORD
            txtEHCCD = !EHCCD
            txtEHAMT = !EHAMT
            txtEHVAM = !EHVAM
            txtEHBCA = !EHBAM
            txtEHBVA = !EHBVA
            txtEHSNO = !EHSNO
            txtMMNME = Find("SMM", "MMNME", " WHERE MMSNO='" & txtEHSNO & "'")
            txtEHDUE = Format(!EHDUE, "dd/mm/yyyy")
           
            .Close
        End With
    End If
    
    If txtELOLN <> "" Then
        Set recECL = DBconn.Execute("select ECL.* from ECL where ECL.ELODN='" & txtEHODN & "' and ELOLN='" & txtELOLN & "'")
        If Not recECL.EOF Then
            With recECL
                txtELITN = !ELITN
                txtELITD = !ELITD
                txtELOLN = !ELOLN
                txtELQTY = !ELQTY
                txtELPSQ = IIf(IsNull(!ELPSQ), 0, !ELPSQ)
                txtELWGT = !ELWGT
                txtELPSW = IIf(IsNull(!ELPSW), 0, !ELPSW)
                txtELPRC = !ELPRC
                'cboELPER = Per(!ELPER)
                For i = 0 To cboELPER.ListCount - 1
                    If Left(cboELPER.List(i), 1) = !ELPER Then
                        cboELPER.ListIndex = i
                        Exit For
                    End If
                Next i
                txtELPDC = !ELPDC
                txtELAMT = !ELAMT ' Line amount
                txtELVAM = !ELVAM ' VAT line (VND)
                txtELBCA = !ELBCA ' Base currency line amount
                txtELBVA = !ELBVA ' VAT base currency
                txtELVAT = !ELVAT
                'cboELSTT = StaOrd(!ELSTT)
                For i = 0 To cboELSTT.ListCount - 1
                    If Left(cboELSTT.List(i), 1) = !ELSTT Then
                        cboELSTT.ListIndex = i
                        Exit For
                    End If
                Next i
                'cboELSTT.ListIndex = Val(!ELSTT) - 1
                .Close
            End With
         End If
    End If
End If


    Adodc3.RecordSource = "Select IMITN , IMITN +'  '+ IMITD  as IMITD FROM IIM where IMRID<>'IZ'"
    Adodc3.Refresh


Adodc4.RecordSource = "Select ECL.*,ECH.* from ECL " & _
    " LEFT JOIN ECH ON ECL.ELODN=ECH.EHODN where ECH.EHODN ='" & txtEHODN & "' ORDER BY ELOLN"
Adodc4.Refresh

End Sub

Private Sub CmdReviewOrd_Click()
frmReview.Tag = "ORD560"
frmReview.Show 1
ISEDITING = False
ISADDING = False

If frmReview.Tag <> "" Then
    txtEHODN = frmReview.Tag
    Unload frmReview
    txtELOLN = 1
    WriteToScreen
    cmdEdit.Enabled = True
    CmdPreInvoice.Enabled = True
End If
End Sub

Private Sub cmdSave_Click()

WriteToFile

End Sub
Private Sub Form_Load()
NewTrans = False
ISEDITING = False
ISADDING = False
OpenFile
ButtonStatus
cmdEdit.Enabled = False
End Sub

Private Sub grdECL_Click()
txtELOLN = grdECL.Columns(1).value
WriteToScreen
 If SELECTROW = "" Then SELECTROW = 1
Adodc4.Recordset.AbsolutePosition = SELECTROW
End Sub

Private Sub grdECL_RowColChange(LastRow As Variant, ByVal LastCol As Integer)
SELECTROW = Adodc4.Recordset.Bookmark
End Sub

Private Sub txtEHCCD_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
    Dim Result As String
    Result = Find("CCM", "CMCCD", "WHERE CMCCD='" & txtEHCCD & "'")
    If Result <> "" Then
        Dim RecCCI As Recordset
        Set RecCCI = DBconn.Execute("Select * from CCI where CICCD='" & txtEHCCD & "' order by CIDTE DESC")
        If Not RecCCI.EOF Then
            txtEHCER = RecCCI!CICCR
        Else
            txtEHCER = 0
        End If
        txtEHCER.SetFocus
    Else
        cboEHCCD.Visible = True
        cboEHCCD.SetFocus
    End If
End If
End Sub


Private Sub txtEHCCD_LostFocus()
    Dim Result As String
    Result = Find("CCM", "CMCCD", "WHERE CMCCD='" & txtEHCCD & "'")
    If Result <> "" Then
        Dim RecCCI As Recordset
        Set RecCCI = DBconn.Execute("Select * from CCI where CICCD='" & txtEHCCD & "' order by CIDTE DESC")
        If Not RecCCI.EOF Then
            txtEHCER = RecCCI!CICCR
        Else
            txtEHCER = 0
        End If
        txtEHCER.SetFocus
    Else
        cboEHCCD.Visible = True
        cboEHCCD.SetFocus
    End If
End Sub

Private Sub txtEHCER_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then txtELITN.SetFocus
End Sub

Private Sub txtEHCNO_KeyPress(KeyAscii As Integer)
Dim Result As String
If KeyAscii = 13 Then
    Result = Find("RCM", "CMNME", "WHERE CMCNO='" & txtEHCNO & "'")
    If Result = "" Then
        cboEHCNO.Visible = True
        cboEHCNO.SetFocus
    Else
        cboEHCNO.Visible = False
        txtCMNME = Result
        txtEHSNO.SetFocus
    End If
End If
End Sub

Private Sub txtEHCPO_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then txtEHCCD.SetFocus
End Sub

Private Sub txtEHDTE_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then txtEHCNO.SetFocus
End Sub

Private Sub txtEHDUE_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then txtEHCPO.SetFocus
End Sub

Private Sub txtEHODN_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
    Result = Find("ECH", "EHODN", "WHERE EHODN='" & txtEHODN & "'")
    If Result = "" Then
       txtEHDTE.SetFocus
    Else
        MsgBox "Order Number is already exist"
        txtEHODN = Result
        NewTrans = False
        ISADDING = False
        ISEDITING = False
        WriteToScreen
        ButtonStatus
    End If
End If
End Sub

Private Sub txtEHSNO_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then
    Dim Result As String
    Result = Find("SMM", "MMNME", "WHERE MMSNO='" & txtEHSNO & "'")
    If Result = "" Then
        cboEHSNO.Visible = True
        cboEHSNO.SetFocus
    Else
        cboEHSNO.Visible = False
        txtMMNME = Result
        txtEHSTN.SetFocus
    End If
End If

End Sub

Private Sub txtEHSTA_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then txtEHDUE.SetFocus
End Sub

Private Sub txtEHSTN_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then txtEHSTA.SetFocus
End Sub

Private Sub txtELAMT_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then txtELVAM.SetFocus
End Sub

Private Sub txtELBCA_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then txtELBVA.SetFocus
End Sub

Private Sub txtELBVA_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then txtELAMT.SetFocus
End Sub

Private Sub txtELITN_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
    Dim Result As String
    Result = Find("IIM", "IMITD", "WHERE IMITN='" & txtELITN & "'")
    If Result = "" Then
        cboELITN.Visible = True
        cboELITN.SetFocus
    Else
       
        txtELITD = Result
        txtELPRC = Find("IIM", "IMPRC", "WHERE IMITN='" & txtELITN & "'")
        cboELITN.Visible = False
        txtELVAT = VATRate(txtEHCNO, txtELITN)
        txtELQTY.SetFocus
    End If
End If
End Sub
Sub OpenFile()
Adodc1.ConnectionString = ConnectString
Adodc1.ConnectionTimeout = 10
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "Select * from RCM"
Adodc1.Refresh

Adodc2.ConnectionString = ConnectString
Adodc2.ConnectionTimeout = 10
Adodc2.CommandType = adCmdText
Adodc2.RecordSource = "Select * from AVM"
Adodc2.Refresh

FieldDel = "IMRID"
DelStatus = "IZ"
SQL = "Select IMITN,IMITN +'  '+IMITD as IMITD  from IIM where " & FieldDel & " <>'" & DelStatus & "' "
Adodc3.ConnectionString = ConnectString
Adodc3.ConnectionTimeout = 10
Adodc3.CommandType = adCmdText
Adodc3.RecordSource = SQL
Adodc3.Refresh

Adodc4.ConnectionString = ConnectString
Adodc4.ConnectionTimeout = 10
Adodc4.CommandType = adCmdText
Adodc4.RecordSource = "Select ECL.*,ECH.* from ECL " & _
    " LEFT JOIN ECH ON ECL.ELODN=ECH.EHODN where ECH.EHODN ='" & txtEHODN & "' ORDER BY ELOLN"
Adodc4.Refresh

Adodc5.ConnectionString = ConnectString
Adodc5.ConnectionTimeout = 10
Adodc5.CommandType = adCmdText
Adodc5.RecordSource = "Select * from CCM"
Adodc5.Refresh

Adodc6.ConnectionString = ConnectString
Adodc6.ConnectionTimeout = 10
Adodc6.CommandType = adCmdText
Adodc6.RecordSource = "Select * from ECH"
Adodc6.Refresh

Adodc7.ConnectionString = ConnectString
Adodc7.ConnectionTimeout = 10
Adodc7.CommandType = adCmdText
Adodc7.RecordSource = "Select * from SMM"
Adodc7.Refresh

' Create array from combobox Custtype,StatusOrder, ValuePer
INVType(1) = "1 Normal"
INVType(2) = "2 By pass Inventory"

StaOrd(1) = "1 New"
StaOrd(2) = "2 Printed"
StaOrd(3) = "3 Confirmed"
StaOrd(4) = "4 B/O"
StaOrd(5) = "5 Caredit hold"
StaOrd(6) = ""
StaOrd(7) = "7 Canceled"
Per(1) = "Unt"
Per(2) = "Wgt"
Per(3) = "All"
End Sub

Sub ButtonStatus()
    cmdReview.Enabled = Not ISEDITING
    CmdPreInvoice.Enabled = Not ISEDITING
    cmdEdit.Enabled = Not ISEDITING
    
    cmdSave.Enabled = ISEDITING
    CmdCancel.Enabled = ISEDITING
    
    FrameBB.Enabled = ISEDITING 'NewTrans
    FrameECLine.Enabled = ISEDITING
End Sub

Sub WriteToFile()
    If Not Ktrastatus Then
        Exit Sub
    End If
    Dim recECL As Recordset
   
    If Not ValidInput() Then Exit Sub
    txtELLDT = Format(Now(), "yyyy-mm-dd hh:mm:ss")
    
    If NewTrans Then
        txtEHLDT = Format(Now(), "yyyy-mm-dd hh:mm:ss")
        txtEHDTE = Format(WorkingDate, "dd/mm/yyyy")
        txtEHDUE = Format(txtEHDUE, "dd/mm/yyyy")
        
        SQL = "Insert into ECH (EHLDT,EHDTE,EHITP" & _
        ",EHODN,EHCNO,EHSTN,EHPTC" & _
        ",EHSTA,EHSNO,EHDUE,EHCPO" & _
        ",EHCCD,EHCER,EHNOL,EHSTT,EHVAT) values " & _
        "('" & txtEHLDT & "','" & Format(txtEHDTE, "yyyy/mm/dd hh:mm:ss") & "','" & cboEHITP.ListIndex + 1 & "'" & _
        ",'" & txtEHODN & "','" & txtEHCNO & "','" & txtEHSTN & "','" & txtEHPTC & "'" & _
        ",'" & txtEHSTA & "','" & txtEHSNO & "','" & Format(txtEHDUE, "yyyy/mm/dd hh:mm:ss") & "','" & txtEHCPO & "'" & _
        ",'" & txtEHCCD & "'," & txtEHCER & "," & txtEHNOL & ",'1','" & txtELVAT & "')"
        'MsgBox SQL
        DBconn.Execute (SQL)
    
    End If
    
    If ISADDING Then
        If txtELITN <> "" Then
            Set recECL = DBconn.Execute("Select * from ECL where ELODN='" & txtEHODN & "' order by ELOLN Desc ")
            If recECL.EOF Then
                txtELOLN = 1
            Else
                txtELOLN = recECL!ELOLN + 1
            End If
            SQL = "Insert into ECL(ELODN,ELITN,ELITD,ELLUS" & _
            ",ELPER,ELOLN,ELSTT " & _
            ",ELQTY,ELWGT,ELPRC,ELPDC" & _
            ",ELAMT,ELVAM,ELBCA,ELBVA,ELPSQ,ELPSW,ELVAT) values " & _
            "('" & txtEHODN & "','" & txtELITN & "','" & txtELITD & "','" & UserLogin & "'" & _
            ",'" & cboELPER.ListIndex + 1 & "','" & txtELOLN & "','1'" & _
            "," & txtELQTY & "," & txtELWGT & "," & txtELPRC & "," & txtELPDC & _
            "," & txtELAMT & "," & txtELVAM & "," & txtELBCA & "," & txtELBVA & "," & txtELPSQ & "," & txtELPSW & "," & txtELVAT & ")"
            
            'MsgBox SQL
            DBconn.Execute (SQL)
            WriteToIIM txtELITN, Val(txtELWGT), Val(txtELQTY)
        End If
    Else
        Select Case cboELPER.ListIndex + 1
        Case 1
            
            txtELBCA = Val(txtELQTY) * (Val(txtELPRC) - (Val(txtELPRC) * Val(txtELPDC) / 100))
            txtELBVA = Val(txtELBCA) * Val(txtELVAT)
                    
            txtELAMT = CLng(Val(txtELQTY) * (Val(txtELPRC) - (Val(txtELPRC) * Val(txtELPDC) / 100)) * Val(txtEHCER))
            txtELVAM = CLng(Val(txtELAMT) * Val(txtELVAT))
            
        Case 2
            
            txtELBCA = Val(txtELWGT) * (Val(txtELPRC) - (Val(txtELPRC) * Val(txtELPDC) / 100))
            txtELBVA = Val(txtELBCA) * Val(txtELVAT)
                    
            txtELAMT = CLng(Val(txtELWGT) * (Val(txtELPRC) - (Val(txtELPRC) * Val(txtELPDC) / 100)) * Val(txtEHCER)) '+ Val(txtELVAM)
            txtELVAM = CLng(Val(txtELAMT) * Val(txtELVAT))
        End Select
        txtEHLDT = Format(Now(), "yyyy-mm-dd hh:mm:ss")
        txtEHDTE = Format(txtEHDTE, "dd/mm/yyyy")
        txtEHDUE = Format(txtEHDUE, "dd/mm/yyyy")
        '///////////////////////////////////////////////////////
        ' Xet trang thai invoice status
        '/////////////////////////////////////////////
        If Left(cboEHSTT.List(cboEHSTT.ListIndex), 1) = "7" Then 'Cancel
            
            Set recECL = DBconn.Execute("Select * from ECL where ELODN='" & txtEHODN & "' AND ELSTT<>'7'")
            With recECL
                Do While Not recECL.EOF
                    WGT = -(!ELWGT)
                    Unt = -(!ELQTY)
                    WriteToIIM !ELITN, WGT, Unt
                    recECL.MoveNext
                Loop
            End With
            SQL = "Update ECL  set ELSTT='7' where ELODN='" & txtEHODN & "'"
            DBconn.Execute SQL
        Else ' Khac cancel
            Set recECL = DBconn.Execute("Select * from ECL where ELODN='" & txtEHODN & "' and ELOLN='" & txtELOLN & "'")
            With recECL
                If Left(cboELSTT.List(cboELSTT.ListIndex), 1) = "7" Then  'Cancel
                    Unt = -(!ELQTY)
                    WGT = -(!ELWGT)
                Else
                    Unt = Val(txtELQTY) - !ELQTY
                    WGT = Val(txtELWGT) - !ELWGT
                End If
            End With
            WriteToIIM txtELITN, WGT, Unt
        End If ' Ket thuc xet trang thai invoice
        
        SQL = "Update ECL set ELLDT='" & txtELLDT & "',ELITN='" & txtELITN & "',ELITD='" & txtELITD & "',ELLUS='" & UserLogin & "'" & _
        ",ELPER='" & cboELPER.ListIndex + 1 & "',ELOLN='" & txtELOLN & "',ELSTT='" & cboELSTT.ListIndex + 1 & "'" & _
        ",ELQTY=" & txtELQTY & ",ELPSQ=" & txtELPSQ & ",ELWGT=" & txtELWGT & ",ELPSW=" & txtELPSW & ",ELPRC=" & txtELPRC & ",ELPDC=" & txtELPDC & _
        ",ELAMT=" & txtELAMT & ",ELVAM=" & txtELVAM & ",ELBCA=" & txtELBCA & ",ELBVA=" & txtELBVA & ",ELVAT=" & txtELVAT & _
        " where ELODN='" & OldEHODN & "' AND ELOLN='" & txtELOLN & "'"
        DBconn.Execute SQL
        
        
        SQL = "Update ECH set EHLDT='" & txtEHLDT & "',EHDTE='" & Format(txtEHDTE, "yyyy/mm/dd hh:mm:ss") & "',EHITP='" & cboEHITP.ListIndex + 1 & "'" & _
        ",EHODN='" & txtEHODN & "',EHCNO='" & txtEHCNO & "',EHSTN='" & txtEHSTN & "',EHPTC='" & txtEHPTC & "'" & _
        ",EHSTA='" & txtEHSTA & "',EHSNO='" & txtEHSNO & "',EHDUE='" & Format(txtEHDUE, "yyyy/mm/dd hh:mm:ss") & "',EHCPO='" & txtEHCPO & "'" & _
        ",EHCCD='" & txtEHCCD & "',EHCER=" & txtEHCER & ",EHVAT=" & txtELVAT & " where EHODN='" & OldEHODN & "'"
        DBconn.Execute SQL
    End If
    Dim RecCountLine As Recordset
    Set RecCountLine = DBconn.Execute("SELECT ELODN, COUNT(ELOLN) AS CountLine From ECL " & _
    " WHERE (ELODN = '" & txtEHODN & "') AND (ELSTT <> N'7')GROUP BY ELODN")
    txtEHNOL = RecCountLine!CountLine
    RecCountLine.Close
    
    recECL.Close
    Set recECL = DBconn.Execute("SELECT ELODN, SUM(ELVAM) AS SumELVAM, SUM(ELAMT)" & _
        " AS SumELAMT, SUM(ELBVA) AS SumELBVA, SUM(ELBCA) " & _
        " AS SumELBCA FROM ECL WHERE (ELODN = '" & txtEHODN & "') GROUP BY ELODN")
    With recECL
        txtEHAMT = !SumELAMT
        txtEHVAM = !SumELVAM
        txtEHBCA = !SumELBCA
        txtEHBVA = !SumELBVA
    End With
    recECL.Close
    
    DBconn.Execute ("UPDATE ECH SET EHAMT=" & txtEHAMT & ",EHVAM=" & txtEHVAM & ",EHBAM=" & txtEHBCA & ",EHBVA=" & txtEHBVA & " WHERE EHODN='" & txtEHODN & "'")
    
    Adodc4.RecordSource = "Select ECL.*,ECH.* from ECL " & _
        " LEFT JOIN ECH ON ECL.ELODN=ECH.EHODN where ECH.EHODN ='" & txtEHODN & "' ORDER BY ELOLN"
    Adodc4.Refresh
    NewTrans = False
    ISADDING = False
    ISEDITING = False
    ButtonStatus
End Sub

Sub WriteToIIM(ITN, WGT, unit)

unit = IIf(IsNumeric(unit), unit, 0)
 WGT = IIf(IsNumeric(WGT), WGT, 0)
    

SQL = "UPDATE IIM SET IMCOW=IMCOW+" & WGT & ",IMCOU=IMCOU+" & unit & " WHERE IMITN='" & ITN & "'"
DBconn.Execute SQL

End Sub


Private Sub txtELPDC_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then txtELPRC.SetFocus
End Sub

Private Sub txtELPRC_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
    If cboELPER.Text <> "" Then
        Call UpdateAmt
    Else
        cboELPER.SetFocus
    End If
End If

End Sub



Private Sub txtELPRC_LostFocus()

    If cboELPER.Text <> "" And txtELPRC.Text <> "" Then
        Call UpdateAmt
    Else
        cboELPER.SetFocus
    End If
End Sub

Private Sub txtELPSQ_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        txtELWGT.SetFocus
        Dim RecIIM As Recordset
        Set RecIIM = DBconn.Execute("Select IMWPU from IIM where IMITN='" & txtELITN & "'")
        If Not RecIIM.EOF Then
            If IsNull(RecIIM!IMWPU) Then
                txtELPSW = ""
                txtELPSW.SetFocus
            Else
                txtELPSW = RecIIM!IMWPU * txtELPSQ
            End If
           
        Else
            txtELPSW = 0
        End If
    End If
End Sub

Private Sub txtELQTY_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        txtELWGT.SetFocus
        Dim RecIIM As Recordset
        Set RecIIM = DBconn.Execute("Select IMWPU from IIM where IMITN='" & txtELITN & "'")
        If Not RecIIM.EOF Then
            If IsNull(RecIIM!IMWPU) Then
                txtELWGT = ""
                txtELWGT.SetFocus
            Else
                txtELWGT = RecIIM!IMWPU * txtELQTY
                txtELPSQ.SetFocus
            End If
        Else
            txtELWGT = 0
        End If
    End If
End Sub

Private Sub txtELVAM_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then cmdSave.SetFocus
End Sub

Private Sub txtELVAT_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then txtELBCA.SetFocus
End Sub

Private Sub txtELWGT_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then txtELPDC.SetFocus

End Sub
Sub tam()
If Left(cboEHSTT.List(cboEHSTT.ListIndex), 1) = "7" Then 'Cancel
        SQL = "Update ECL  set ELSTT='7' where ELODN='" & txtEHODN & "'"
        DBconn.Execute SQL
        
        Set recECL = DBconn.Execute("Select * from ECL where ELODN='" & txtEHODN & "'")
        With recECL
            Do While Not recECL.EOF
                WGT = -(!ELWGT)
                Unt = -(!ELQTY)
                WriteToIIM !ELITN, WGT, Unt
                recECL.MoveNext
            Loop
        End With
    Else
        Set recECL = DBconn.Execute("Select * from ECL where ELODN='" & txtEHODN & "' and ELOLN='" & txtELOLN & "'")
        With recECL
            If Left(cboELSTT.List(cboELSTT.ListIndex), 1) = "7" Then  'Cancel
                Unt = -(recECL!ELQTY)
                WGT = -(recECL!ELWGT)
            Else
                Unt = recECL!ELQTY - Val(txtELQTY)
                WGT = recECL!ELWGT - Val(txtELWGT)
            End If
        End With
        WriteToIIM txtELITN, WGT, Unt
    End If
End Sub

Function ValidInput()
Dim Result
Dim StrErr As String, Havelot As Byte
Havelot = False
If Not IsDate(txtEHDTE) Then StrErr = StrErr & Chr(13) & "* Wrong Invoice Date!"
If Not IsDate(txtEHDUE) Then StrErr = StrErr & Chr(13) & "* Wrong Due Date!"
If Find("RCM", "CMCNO", "WHERE CMCNO='" & txtEHCNO & "'") = "" Then StrErr = StrErr & Chr(13) & "* Not have Customer"

If Find("CCM", "CMCCD", "WHERE CMCCD='" & txtEHCCD & "'") = "" Then StrErr = StrErr & Chr(13) & "* Not have Currency code"


If txtELQTY = 0 Then StrErr = StrErr & Chr(13) & "* Quantity must be >0"
If txtELWGT = 0 Then StrErr = StrErr & Chr(13) & "* Weight must be >0"
If StrErr <> "" Then
    MsgBox "Please check again!" & StrErr
    ValidInput = False
Else
    ValidInput = True
End If
End Function


Private Function Ktrastatus() As Boolean
    Ktrastatus = True
    If (txtELQTY = "" Or txtELPSQ = "" Or txtELWGT = "" Or txtELPSW = "") Then
        MsgBox "One of Quantity, Weight must be have value"
        Ktrastatus = False
    ElseIf (txtEHCER = "" Or txtEHCCD = "" Or txtELPDC = "" Or txtELVAT = "" Or txtELPRC = "") Then
        MsgBox "One of Current code,Exchange rate, Discount,Price per, Vat must be have value"
        Ktrastatus = False
    ElseIf txtELITN = "" Or txtELITD = "" Then
        MsgBox "One of Item, Item description must be have value"
        Ktrastatus = False
    End If
    
End Function
